package cn.tedu_01;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import sun.java2d.pipe.SpanIterator;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Locale;

public class Test {
    public static void main(String[] args) {
        String s =new String();

        char [] value={'h','e','l','l','o'};
        String s2=new String(value);

        String s3= "jack";
        s3="rose";


        char a =s2.charAt(0);
        System.out.println(a);

        String b=s2.concat("123");
        System.out.println(b);
        System.out.println(s2);

        boolean c=s2.endsWith("lo");
        System.out.println(c);

        System.out.println(s2.contains("o"));
        System.out.println(s2.endsWith("o"));
        System.out.println(s2.equals("hello"));
        System.out.println(s2.hashCode());
        System.out.println(s2.indexOf("l"));
        System.out.println(s2.isEmpty());
        System.out.println(s2.length());
        System.out.println(s2.replace('l', 'a'));
        System.out.println(s2.endsWith("e"));
        System.out.println(s2.startsWith("ys"));
        System.out.println(s2.substring(2));
        System.out.println(s2.substring(1, 3));
        System.out.println(s2.toLowerCase());
        System.out.println(s2.toUpperCase());
        s2="avc";
        System.out.println(s2);
        System.out.println(s2.trim());
        System.out.println(s2.matches("avc"));
        String x= String.valueOf(100);
        System.out.println(x+5);

        byte[] bs=s2.getBytes();
        System.out.println(s2);
        System.out.println(Arrays.toString(bs));
        s2="abcadaefg";
        String []ss = s2.split("a");
        System.out.println(Arrays.toString(ss));

        char [] cs=s2.toCharArray();
        System.out.println(Arrays.toString(cs));

        s2="abcdefg";
        byte [] bs2=s2.getBytes();
        System.out.println(Arrays.toString(bs2));

        char [] cs2= s2.toCharArray();
        System.out.println(Arrays.toString(cs2));

//        //TODO String练习：获取指定字符串里的每个字符
//        String m= "abcdfghifklmn";
//        char [] c3= m.toCharArray();
//        System.out.println(Arrays.toString(c3));
//        for(int i =0;i<c3.length;i++){
//            System.out.print(c3[i]);
//        }
//        byte [] b2= m.getBytes();
//        System.out.println(Arrays.toString(b2));
//        for(int i= 0;i<b2.length;i++){
//        byte data =b2[i];
//            char n2 =(char)data;
//            System.out.print(n2);
//        }
//
//        for(int i = 0;i<m.length();i++){
//         char data = m.charAt(i);
//            System.out.println(data);
//        }

        //TODO String练习：获取指定字符串里的每个字符
//        String m ="abcdefghijklmn";
//        char[] n =m.toCharArray();
//        for(int i =0;i<n.length;i++){
//            System.out.println(n[i]);
//        }
//
//        byte [] m2 =m.getBytes();
//        for(int i = 0;i<m2.length;i++){
//            byte data =m2[i];
//            char n2= (char)data;
//            System.out.println(n2);
//        }
//
//        for(int i = 0;i<m.length();i++){
//            char data =m.charAt(i);
//            System.out.println(data);
//
//        }

        System.out.println("=========================");
        //TODO String练习：获取指定字符串里的每个字符
        String m ="abcdefghijklmn";
        for(int i= 0;i<m.length();i++){
                char data =m.charAt(i);
            System.out.println(data);
        }

        byte [] n =m.getBytes();
        for(int i = 0;i<n.length;i++){
          byte data = n[i];
         char n2= (char)data;
            System.out.println(n2);
        }

        char [] n1 =m.toCharArray();
        for(int i = 0;i<n1.length;i++){
            System.out.println(n1[i]);
        }

        //StringBuilder StringBuffer;



    }




}
